
<!-- index.html.erb -->
<div class="row wrapper wrapper-content animated fadeInUp">
  <div class="col-md-7">
    <%= ibox do %>
      <%= ibox_title '列表名称' do %>
        <%= link_to [:new, :admin, :model], class: "btn btn-xs btn-w-m btn-primary" do %>
          <i class="fa fa-plus"></i>
        <% end %>
      <% end %>

      <%= ibox_content do %>
        <%= render 'list'%>
      <% end %>
    <% end %>
  </div>

  <% unless @models.empty? %>
    <div class="col-md-5 admin-table-detail">
    </div>
  <% end %>
</div>


<!-- _list.html.erb -->
<% if models.empty? %>
  <p class="alert alert-warning">
    没有符合条件的记录
  </p>
<% else %>
  <%= admin_table class: "table-hover", data: {"ajax-target" => '.admin-table-detail'} do %>
    <thead>
      <tr>
        <th></th>
        <th><%= Model.human_attribute_name :name %></th>
        <th><%= Model.human_attribute_name :desc %></th>
      </tr>
    </thead>
    <tbody>
      <% models.each_with_index do |model, i| %>
        <tr data-ajax-href="<%= url_for([:admin, model]) %>">
          <td><%= index_of_item(i, page_size) %></td>
          <td><%= model.name %></td>
          <td><%= model.desc %></td>
        </tr>
      <% end %>
    </tbody>
  <% end %>
  <%= paginate models %>
<% end %>


<!-- _detail.html.erb -->
<%= ibox do %>
  <%= ibox_title "记录详情" %>
  <%= ibox_content do %>

    <div class="text-center margin-bottom-30">
      <h2 class="title">
        <%= model.name %>
      </h2>

      <%= image_tag model.image, class: 'detail-image img-circle' %>

      <div class="actions">
        <%= light_button_to '编辑', [:edit, :admin,  model], 'pencil' %>
        <%= light_method_button_to '删除', [:admin,  model], 'trash', 'delete', {confirm: '确认删除？'} %>
      </div>
    </div>

    <div data-id="<%= model.id %>" class="client-detail">
      <div class="full-height-scroll">
        <h4>记录信息</h4>
        <table class="table table-striped">
          <tr>
            <td width="35%"><%= model.human_attribute_name :name %>：</td>
            <td><%= model.name %></td>
          </tr>
          <tr>
            <td width="35%"><%= model.human_attribute_name :desc %>：</td>
            <td><%= model.desc %></td>
          </tr>
        </table>
      </div>
    </div>
  <% end %>
<% end %>
    



